import request from '@/common/request/request.js'

import Vue from 'vue'
import {
	formatGetUri
} from '@/common/request/util.js'

const api = {}
const PORT1 = ''
import {
	getStorageWidthSex
} from '@/common/request/storageSyncData.js'


//  搜索书本信息
api.getBookSearch = params => request.globalRequest(`${PORT1}/api/book/search${formatGetUri(params)}`, 'GET', {}, 1)

//  搜索书本章节信息
// api.chapterList = params => request.globalRequest(`${PORT1}/api/chapter/242/list${formatGetUri(params)}`, 'GET', {}, 1)
api.chapterList = params => request.globalRequest(`${PORT1}/api/chapter/${params}/list`, 'GET', {}, 1)

//  获取章节详情
api.chapterDetail = params => request.globalRequest(`${PORT1}/api/chapter/${params.bookCode}/${params.chapterCode}`,
	'GET', {}, 1)

//  获取排行榜列表
api.getRankInfoList = params => request.globalRequest(`${PORT1}/api/rank/info${formatGetUri(params)}`, 'GET', {}, 1);

//  获取排行榜书本列表
api.getRankItemDetail = params => request.globalRequest(`${PORT1}/api/rank/${params}`, 'GET', {}, 1)

//  获取分类榜列表
api.getCateInfoList = params => request.globalRequest(`${PORT1}/api/cate/info${formatGetUri(params)}`, 'GET', {}, 1);

//  获取分类榜书本列表
api.getCateItemDetail = params => request.globalRequest(`${PORT1}/api/cate/${params.code}${formatGetUri(params.info)}`,
	'GET', {}, 1);

//  获取首页分类列表
api.homeRankDatas = params => request.globalRequest(`${PORT1}/api/home/${getStorageWidthSex().id.toString()}`, 'GET', {}, 1)


export default api
